package com.lyl.excel.valid;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * @author Mr.Luo
 */
@Data
public  class ExcelResult<T> {
    private final AtomicInteger replaceCount = new AtomicInteger();
    private final AtomicInteger unReplaceCount = new AtomicInteger();
    private final List<T> errorData = new ArrayList<>();

    public void addUnReplaceCount() {
        unReplaceCount.incrementAndGet();
    }

    public void addReplaceCount() {
        replaceCount.incrementAndGet();
    }

    public void setReplaceCount(Integer count) {
        replaceCount.compareAndSet(replaceCount.intValue(), count);
    }

    public void addErrorData(T t) {
        errorData.add(t);
    }
}
